//    Copyright (C) Kherty.  All rights reserved.
#region

using OpenLS.Chart.Serialization;
using OpenLS.Core.Serialization;

#endregion

namespace OpenLS.Chart
{
    internal class DrawingRelativeAnchor : DrawingAnchor
    {
        private AnchorMarker _fnom;

        private AnchorMarker _to;

        public AnchorMarker From
        {
            get { return _fnom; }
            set { _fnom = value; }
        }

        public AnchorMarker To
        {
            get { return _to; }
            set { _to = value; }
        }

        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read(ChartConstants.ChartDrawingNamespace + "relSizeAnchor"))
            {
                From = c.ReadElementAs<AnchorMarker>("from");
                To = c.ReadElementAs<AnchorMarker>("to");
                ReadXmlBase(c);
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (var c = context.Write(ChartConstants.ChartDrawingNamespace + "relSizeAnchor"))
            {
                c.WriteElementAs(From, "from");
                c.WriteElementAs(To, "to");
                WriteXmlBase(c);
            }
        }
    }
}